import {getAllExpense,addExpense,deleteExpense} from '@/api/index'
const state={
    //订单采购信息
    expenseList:[],
    //药品信息
    medicineList:[]
};
const mutations={
    //获取所有采购信息
    GETALLEXPENSE(state,data){
        state.expenseList=data.expenses;
        state.medicineList=data.medicines;
    }
};
const actions={
    //获取所有采购信息
    async getAllExpense({commit}){
        const {data}=await getAllExpense();
        console.log(data);
        if(data.code==200){
            commit('GETALLEXPENSE',data);
        }
    },
    //添加采购信息
    async addExpenseInfo({commit},data){
        const result=await addExpense(data);
        console.log(result);
    },
    //删除采购信息
    async deleteExpenseInfo({commit},data){
        const result=await deleteExpense(data);
        console.log(result);
    }
};
const getters={};
export default {state,mutations,actions}